<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript">
    function checkForm(){
        var bookId = document.getElementById("bookId").value;
        var bookName = document.getElementById("bookName").value;
        var borrowTime = document.getElementById("borrowTime").value;
        var returnTime = document.getElementById("returnTime").value;
        if(bookId == null || bookId == ""){
            alert("图书编号不能为空");
            return false;
        }
        if(bookName == null || bookName == ""){
            alert("图书名称不能为空");
            return false;
        }
        if(borrowTime == null || borrowTime == ""){
            alert("借阅时间不能为空");
            return false;
        }
        if(returnTime == null || returnTime == ""){
            alert("归还时间不能为空");
            return false;
        }
        return true;
    }
    //选中左侧菜单栏
    $(document).ready(function(){
        $("#bookBorrow").addClass("active");
    });
</script>
<div class="data_list">
    <div class="data_list_title">
        添加图书借阅
    </div>
    <form action="bookBorrowServlet.action?action=save" method="post" onsubmit="return checkForm()">
        <div class="data_form" >
            <table align="center">
                <tr>
                    <td><font color="red">*</font>&nbsp;图书编号：</td>
                    <td><input type="text" id="bookId"  name="bookId" style="margin-top:5px;height:30px;" /></td>
                </tr>
                <tr>
                    <td><font color="red">*</font>&nbsp;图书名称：</td>
                    <td><input type="text" id="bookName"  name="bookName" style="margin-top:5px;height:30px;" /></td>
                </tr>
                <tr>
                    <td><font color="red">*</font>&nbsp;借阅时间：</td>
                    <td><input type="text" id="borrowTime"  name="borrowTime" style="margin-top:5px;height:30px;" /></td>
                </tr>
                <tr>
                    <td><font color="red">*</font>&nbsp;归还时间：</td>
                    <td><input type="text" id="returnTime"  name="returnTime" style="margin-top:5px;height:30px;" /></td>
                </tr>
            </table>
            <div align="center">
                <input type="submit" class="btn btn-primary" value="保存"/>
                &nbsp;<button class="btn btn-primary" type="button" onclick="javascript:history.back()">返回</button>
            </div>
            <div align="center">
                <font id="error" color="red">${requestScope.error}</font>
            </div>
        </div>
    </form>
</div>

